/**
 * Created by CZ on 2017/4/21.
 */
module.exports = function ($scope,$state,RequestService,$localStorage,modelService,commonConfig) {
    //获取当前用户信息 (value = "审批状态", notes = "默认0，未审批为0，审批通过为1，审批不通过为-1")
    $scope.getUnapprovedList = function(){
        RequestService.Request(commonConfig.cloudApi+'cloud/tenant/getTenantListByStatus?status=0','GET').then(function(response){
            console.log(response);
            $scope.UnapprovedList = response;
        },function(error){
            console.log(error);
        });
    };
    $scope.getUnapprovedList();

    //审批操作
    $scope.Approved = function(id){
        RequestService.Request(commonConfig.cloudApi+'cloud/tenant/setStatus?id='+id,'GET').then(function(response){
            console.log(response);
           if(response.code == 0){
               $scope.getUnapprovedList();
           }else {
               modelService.openTipsModel(response.message);
           }
        },function(error){
            console.log(error);
        });
    };
    $scope.Unapproved = function(id){
        RequestService.Request(commonConfig.cloudApi+'cloud/tenant/setNotStatus?id='+id,'GET').then(function(response){
            console.log(response);
            if(response.code == 0){
                $scope.getUnapprovedList();
            }else {
                modelService.openTipsModel(response.message);
            }
        },function(error){
            console.log(error);
        });
    }

};